#!/usr/bin/env python

import sys, os
from SSHBatch import Main

def guess_config_fpath():
	if os.path.exists(os.path.expanduser("~/.sshbatch.conf")):
		return os.path.expanduser("~/.sshbatch.conf")
	for fdir in ["/etc", "/usr/etc", "/usr/local/etc"]:
		if os.path.exists(fdir + "/sshbatch.conf"):
			return fdir + "/sshbatch.conf"
	return None

if len(sys.argv) == 1:
	config_fpath = guess_config_fpath()
	if not config_fpath:
		Main.usage(sys.argv)
	sys.argv.append("-c")
	sys.argv.append(config_fpath)

Main.main(sys.argv)
